﻿using ViewMaker.Core.Controls;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using ViewMaker.Core;
using System.Collections.Generic;
using System.Windows.Controls;

namespace ViewMaker.Core.Tests
{
    [TestClass()]
    public class LiteralViewControlTest
    {
        [TestMethod()]
        public void 標準的なLiteralのXAML生成()
        {
            var target = new LiteralViewControl { Item = new ViewLayoutItem { Name = "l001", Caption = "リテラル", BindPath = "valuePath" } };
            target.Literal = "<TextBlock xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\">Hello</TextBlock>";
            var xaml = target.CreateXaml(TestHelper.CreateTestParent())[1];

            var actual = TestHelper.GetFrameworkElement<TextBlock>(xaml);
            Assert.AreEqual("Hello", actual.Text);

        }

        [TestMethod()]
        public void LiteralViewControlの編集画面が表示可能()
        {
            var target = new LiteralViewControl { Item = new ViewLayoutItem { Name = "l001", Caption = "リテラル", BindPath = "valuePath" } };
            target.Literal = "<TextBlock xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\">Hello</TextBlock>";
            var baml = ViewUtil.BuildContent(target);
            Assert.IsNotNull(baml);
        }

    }
}
